#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const int N = 2010;
const int INF = 0x3f3f3f3f;
int n, a[N][N];

signed main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> n;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> a[i][j];
		}
	}
	int ans = -INF, sum = 0;

	for (int i = 1; i <= n; i++) {
		sum = 0;
		for (int j = 1; j <= n; j++) {
			sum += a[i][j];
		}
		ans = max(ans, sum);
	}

	for (int i = 1; i <= n; i++) {
		sum = 0;
		for (int j = 1; j <= n; j++) {
			sum += a[j][i];
		}
		ans = max(ans, sum);
	}

	for (int i = 1 - n; i <= n - 1; i++) {
		sum = 0;
		for (int j = 1; j <= n; j++) {
			if (j - i >= 1 && j - i <= n) sum += a[j][j - i];
		}
		ans = max(ans, sum);
	}
	
	for (int i = 2; i <= 2 * n; i++) {
		sum = 0;
		for (int j = 1; j <= n; j++) {
			if (i - j >= 1 && i - j <= n) sum += a[j][i - j];
		}
		ans = max(ans, sum);
	}

	cout << ans << endl;
	return 0;
}